package jgl.vajra.management.part.home.viewModel;

import java.util.List;
import java.util.Map;

import jgl.vajra.management.bean.CarMemberBean;
import jgl.vajra.management.bean.LoginInfoBean;
import jgl.vajra.management.part.home.contract.MinePageContract;
import jgl.vajra.management.part.home.model.MinePageModel;
import jgl.vajra.management.widget.mvvm.factory.CreateModel;
import jgl.vajra.management.widget.retrofithelper.rxsubscriber.ProgressObserver;

@CreateModel(MinePageModel.class)
public class MinePageViewModel extends MinePageContract.ViewModel {
    @Override
    public void getMineData(Map<String, Object> map) {
        mModel.getMineData(map).subscribe(new ProgressObserver<LoginInfoBean>(true,this) {
            @Override
            public void _onNext(LoginInfoBean data) {
                mView.returnMineData(data);
            }

            @Override
            public void _onError(String errorMessage, int errorCode) {
                super._onError(errorMessage, errorCode);
            }
        });
    }

    @Override
    public void getCarMemberData(Map<String, Object> map) {
        mModel.getCarMemberData(map).subscribe(new ProgressObserver<List<CarMemberBean>>(false,this) {
            @Override
            public void _onNext(List<CarMemberBean> data) {
                mView.returnCarMemberData(data);

            }

            @Override
            public void _onError(String errorMessage, int errorCode) {
                super._onError(errorMessage, errorCode);
            }
        });
    }
}
